A descriptor object contains information that fully specifies certain OPC entity (but does not contain any “extra” information that is not needed to identify it uniquely). Descriptor objects are used by some method overloads to reduce the number of individual arguments, and to organize them logically.
There are following types of descriptor objects for OPC Classic:
There are following types of descriptor objects for OPC UA:
Note: For OPC-UA, the meaning of these objects is described further below in chapter “Identifying Information in OPC-UA”.
In a ServerDescriptor, the primary means of server identification is the ServerClass property, which contains a string that can hold either ProgID of the server, or its {CLSID}. There are also additional ServerDescriptor properties, all related to the ServerClass property, allowing to individually retrieve or modify parts of the server class designation. The ProgId property contains a ProgID of the server (and is an empty string if the ProgID is not given). The Clsid property contains the CLSID of the server in a form of a Guid (and is Guid.Empty if no CLSID for the server is given). The ClsidString property contains the CLSID string of the server (and is an empty string if no CLSID for the server is given). The ObjectId property contains the object ID, i.e. a ProgID, {CLSID}, or ProgID/{CLSID}.
Each ServerDescriptor is also represented in a string form that uses the URL syntax (e.g. “opcda://127.0.0.1/Kepware.KEPServerEX.V5/{B3AF0BF6-4C0C-4804-A122-6F3B160F4397}”). For more information about these “OPC URLs”, see http://www.opclabs.com/resources/developer-blog/1086-a-partial-story-of-opc-urls .
If you have received an element object (e.g. from browsing methods or common OPC dialogs), you can convert it to a descriptor object. In OPC Classic, for example, there is a constructor for ServerDescriptor object that accepts ServerElement as an input, and there is a constructor for DAItemDescriptor object that accepts DANodeElement as an input, too. In OPC UA, there is a constructor for UAEndpointDescriptor object that accepts UADiscoveryElement as an input, and there is a constructor for UANodeDescriptor object that accepts UANodeElement as an input, too.
Nodes and items in OPC address space can be specified using their node Id (or item Id), or using so-called browse paths.
The item Id (or node Id) is a string that uniquely addresses an item (or a node) in OPC address space. Its syntax is determined by the OPC server. It usually consists of the names of nodes used to reach that node from the root of the OPC address space, together with some decorating characters and separators. This is not a requirement, however, and the OPC server may even use item Ids that do not resemble the node names at all. Unless you have detailed knowledge of the particular OPC server you are connecting to, you should not attempt to create item Id strings yourself, from various parts – they should always come from the server. Item Ids (node Ids) are specified by the ItemId property of the DANodeDescriptor or DAItemDescriptor object. Strings convert implicitly to DANodeDescriptor or DAItemDescriptor containing the input string as the value of ItemId property, and you can therefore simply use the string item Ids in place of node and item descriptors.